﻿<Window x:Class="WpfImageReceiver.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:this="clr-namespace:WpfImageReceiver"
    xmlns:camera="clr-namespace:BrainTechLLC.WebCamLib3;assembly=BrainTechLLC.WebCamLib3"
    Title="Window1" Height="300" Width="400">
    <Window.CommandBindings>
        <CommandBinding x:Name="closeCommand" Command="ApplicationCommands.Close" Executed="closeCommand_Executed" />
    </Window.CommandBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="120"/>
        </Grid.RowDefinitions>
        <Menu Grid.Row="0" Grid.RowSpan="2">
            <MenuItem Header="_File">
                <MenuItem Header="E_xit" Command="ApplicationCommands.Close"></MenuItem>
            </MenuItem>
            <MenuItem Header="_View">
                <MenuItem x:Name="mnuCameraControl" Header="_Camera Control" IsCheckable="True"></MenuItem>
                <MenuItem x:Name="mnuConnect" Header="_Connect" IsCheckable="True" Click="btnConnect_Click"></MenuItem>
                <TextBox x:Name="txtHost" Text="{Binding Mode=TwoWay, Path=HostName}" HorizontalAlignment="Stretch" />
            </MenuItem>
        </Menu>
        <TextBlock Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top" FontSize="16" Text="*" Visibility="{Binding Mode=OneWay, Path=Connected, Converter={x:Static this:TypeConverters.VisibilityConverter}}"/>
        <camera:CameraControl Grid.Row="1"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="Green" BorderThickness="2,2,2,2" 
                x:Name="cameraControl" Visibility="{Binding Mode=TwoWay, ElementName=mnuCameraControl, Path=IsChecked, Converter={x:Static this:TypeConverters.VisibilityConverter}}" />
        <Grid Grid.Row="2" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <this:CameraHandlerView x:Name="handlerView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
        </Grid>
    </Grid>
</Window>
